using System;
using System.Windows.Forms;

namespace CastleSample.UI.Core
{
    /// <summary>
    /// Interface to declare the service provided by container of UI.
    /// </summary>
    public class MainFrame : Form
    {
        public virtual MenuItemInfo FindMenuItem(string key)
        {
            throw new NotImplementedException();
        }

        public virtual bool RegisterMenuItem(MenuItemInfo menuItem)
        {
            throw new NotImplementedException();
        }

        public virtual bool RegisterMenuItem(MenuItemInfo menuItem, string relatedMenuKey, MenuItemPosition position)
        {
            throw new NotImplementedException();
        }

        public virtual bool RegisterMenuItemBefore(string beforeMenuItemKey, string key, string caption)
        {
            MenuItemInfo menuItem = new MenuItemInfo(key, caption);
            return RegisterMenuItem(menuItem, beforeMenuItemKey, MenuItemPosition.Before);
        }

        public virtual bool RegisterMenuItemBefore(string beforeMenuItemKey, string key, string caption,
                                                    EventHandler clickEventhandler)
        {
            MenuItemInfo menuItem = new MenuItemInfo(key, caption, clickEventhandler);
            return RegisterMenuItem(menuItem, beforeMenuItemKey, MenuItemPosition.Before);
        }

        public virtual bool RegisterMenuItemAfter(string afterMenuItemKey, string key, string caption)
        {
            MenuItemInfo menuItem = new MenuItemInfo(key, caption);
            return RegisterMenuItem(menuItem, afterMenuItemKey, MenuItemPosition.After);
        }

        public virtual bool RegisterMenuItemAfter(string afterMenuItemKey, string key, string caption,
                                                   EventHandler clickEventhandler)
        {
            MenuItemInfo menuItem = new MenuItemInfo(key, caption, clickEventhandler);
            return RegisterMenuItem(menuItem, afterMenuItemKey, MenuItemPosition.After);
        }

        public virtual void UnregisterMenuItem(string key)
        {
            throw new NotImplementedException();
        }
    }

    public enum MenuItemPosition
    {
        ChildFirst,
        ChildLast,
        Before,
        After
    }
}